#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
    printf("process is running, only me! pid: %d\n", getpid());
    sleep(1);
    pid_t id = fork();
    if(id == -1)
    {
        return 1;
    }
    else if(id == 0)
    {
        int cnt = 3;
        while(cnt)
        {
            printf("I am child process, pid: %d\n", getpid());
            sleep(1);
        }
    }
    else
    {
        int cnt = 3;
        while(cnt--)
        {
            printf("I am parent process, pid: %d\n", getpid());
            sleep(1);
        }
    }

    return 0;
}
